﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Crift
{
    public class Register
    {
        public static int length = 28;
        public BitArray InnerRegister;
        

        public Register(string seed)
        {
            seed = Conversions.StringToBits(seed);
            InnerRegister = new BitArray(seed.Length);
            for (int i = 0; i < seed.Length; i++) InnerRegister[i] = Conversions.BitTobool(seed[i]);
        }
       
        public void ShiftRight()
        {
            bool temp = InnerRegister[27] ^ InnerRegister[1] ^ InnerRegister[0];
            for (int i = length - 1; i >= 1; i--) InnerRegister[i] = InnerRegister[i - 1];
            InnerRegister[0] = temp;
        }
        public bool GetBit()
        {
            bool result = InnerRegister[length - 1];
            ShiftRight();
            return result;
        }


    }

}